package com.boarsoft.boar.demo.user.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.boarsoft.boar.demo.user.biz.PocUserBiz;
import com.boarsoft.boar.demo.user.entity.PocUser;
import com.boarsoft.dao.sharding.bean.DaoSharding;

@Component("userService")
public class PocUserServiceImpl implements PocUserService {

	@Autowired
	private PocUserBiz userBiz;

	@Override
	@DaoSharding(policy = "tenant", index = 0)
	public boolean add(int tenantId, PocUser user) {
		return userBiz.add(tenantId, user);
	}

	@Override
	// @Cached(group = "user", index = 0)
	@DaoSharding(policy = "tenant", index = 0)
	public PocUser find(int tenantId, int userId) {
		return userBiz.findById(tenantId, userId);
	}

}
